<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <link rel="http://localhost/arcgis_js_v416_sdk/arcgis_js_api/library/4.16/esri/css/main.css" />

    <script src="http://localhost/arcgis_js_v416_sdk/arcgis_js_api/library/4.16/dojo/dojo.js"></script>

    <style>
        html,
        body,
        #viewDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }
    </style>

    <script>
        dojo.declare("BaiduLayer", esri.layers.TiledMapServiceLayer, {
            constructor: function() {
                this.spatialReference = new esri.SpatialReference({
                    wkid: 102113
                });
                this.initialExtent = (this.fullExtent = new esri.geometry.Extent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, this.spatialReference));
                this.tileInfo = new esri.layers.TileInfo({
                    "rows": 256,
                    "cols": 256,
                    "compressionQuality": 0,
                    "origin": {
                        "x": -20037508.342787,
                        "y": 20037508.342787
                    },
                    "spatialReference": {
                        "wkid": 102113
                    },
                    "lods": [{
                        "level": 0,
                        "resolution": 156543.033928,
                        "scale": 591657527.591555
                    }, {
                        "level": 1,
                        "resolution": 78271.5169639999,
                        "scale": 295828763.795777
                    }, {
                        "level": 2,
                        "resolution": 39135.7584820001,
                        "scale": 147914381.897889
                    }, {
                        "level": 3,
                        "resolution": 19567.8792409999,
                        "scale": 73957190.948944
                    }, {
                        "level": 4,
                        "resolution": 9783.93962049996,
                        "scale": 36978595.474472
                    }]
                });
                this.loaded = true;
                this.onLoad(this);
            },

            getTileUrl: function(level, rows, col) {
                var zoom = level - 1;
                var offsetX = Math.pow(2, zoom);
                var offsetY = offsetX - 1;
                var numX = col - offsetX;
                var numY = (-row) + offsetY;
                zoom = level + 1;
                var num = (col + row) % 8 + 1;
                var url = "http://q3.baidu.com/it/u=x=" + numX + ";y+" + numY + ";z=" + zoom + ";v=015;type=web$fm=44";
                return url;
            }

        })

        var baidu = new BaiduLayer();
        map.addLayer(baidu);
    </script>

</head>

<body>
    <div id="viewDiv"></div>


</body>

</html>

<!-- 
dojo.declare 定义类,简单明确的完成类的声明.
dojo.declare 参数定义
dojo.declare(/*String*/  className, 
/*Function | Function[]*/ superclass, 
/*Object*/ props ) 

className: 是要要申明的类的类名，也就是创建的构造函数的名称。
superclass：所要继承的父类，此参数可为 null，表示没有父类，或者为一个父类，或为多个父类的数组，会在后续小节内详述。
props：散列体，由名、值（key, value）对组成，这个散列体将被添加到定义的类的原型对象中，也即为定义的类被其所有实例共享的属性及方法。其中，key ：constructor 为保留字，此函数用来初始化新对象。
-->